Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.0.alpha.6 (Sourcery refactored) #248

Closed
wants to merge 1 commit into from

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Oct 16, 2023

Pull Request #246 refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the develop branch, then run:

git fetch origin sourcery/develop
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from cleder October 16, 2023 11:25
@watermelon-copilot-for-code-review

@what-the-diff
Copy link

what-the-diff bot commented Oct 16, 2023

PR Summary

  • Enhanced Geometry Property Handling
    In fastkml/kml.py, we improved how the geometry property operates. Now, if geometry has a valid value, it's returned; if it's not assigned, it would return None. This might improve how our code handles uncertain or missing values.

  • Improved Boolean Function
    In fastkml/styles.py, we made a change to the strtobool function. It now converts "true" to 1 and any other input into an integer form of the value after converting it to a float first. This can increase the accuracy of our operations involving boolean values.

  • Stricter Element Validation
    Also in fastkml/styles.py, we've added rigorous checks to the from_element method. It will now throw a ValueError if the key element doesn't meet the required criteria ("highlight" or "normal"). This ensures that only valid input values are processed, adding a layer of data integrity.

  • Adjusted Test Method
    In our tests/base_test.py, we've adjusted the test_base_from_element_raises method. Now, it uses the config.KMLNS value to create the element variable. This adjustment can help us ensure more accurate testing situations.

@ghost
Copy link

ghost commented Oct 16, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (b773b94) 93.18% compared to head (b071191) 93.24%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #248      +/-   ##
===========================================
+ Coverage    93.18%   93.24%   +0.05%     
===========================================
  Files           33       33              
  Lines         4787     4781       -6     
===========================================
- Hits          4461     4458       -3     
+ Misses         326      323       -3     
Files Coverage Δ
fastkml/kml.py 78.17% <100.00%> (+0.05%) ⬆️
fastkml/styles.py 95.94% <100.00%> (+0.61%) ⬆️
tests/base_test.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@watermelon-copilot-for-code-review

@watermelon-copilot-for-code-review

@sourcery-ai sourcery-ai bot changed the title Release 1.0.alpha.5 (Sourcery refactored) Release 1.0.alpha.6 (Sourcery refactored) Oct 16, 2023
@watermelon-copilot-for-code-review

@watermelon-copilot-for-code-review

if self._geometry is not None:
return self._geometry.geometry
return None
return self._geometry.geometry if self._geometry is not None else None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Placemark.geometry refactored with the following changes:

if val == "true":
return 1
return int(float(val))
return 1 if val == "true" else int(float(val))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PolyStyle.from_element refactored with the following changes:

Comment on lines -631 to +629
if key is None:
if key is None or key.text not in ["highlight", "normal"]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function StyleMap.from_element refactored with the following changes:

element = cast(
types.Element,
config.etree.Element(config.KMLNS + "Base"), # type: ignore[attr-defined]
)
element = cast(types.Element, config.etree.Element(f"{config.KMLNS}Base"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TestStdLibrary.test_base_from_element_raises refactored with the following changes:

This removes the following comments ( why? ):

# type: ignore[attr-defined]

@sourcery-ai sourcery-ai bot closed this Oct 16, 2023
@sourcery-ai sourcery-ai bot deleted the sourcery/develop branch October 16, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants